import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'


Vue.config.productionTip = false;

import '@/utils/request.js'; // axios 
import '@/utils/vant.js'; //  vant 组件库

//  在这调用 
// getuserInfo  两个地方需要用   
// 浪费  
let token = localStorage.getItem('token'); 
let tokenExpired = localStorage.getItem('tokenExpired'); 
// 判断token存在吗  存在的话 证明登陆过  不存在的话证明没登录

let now = new Date().getTime(); // 时间戳 



if(token&&tokenExpired>now){
	
   store.dispatch('GET_USERINFO',token);
	
}else{
	//  
	if(token){
		localStorage.removeItem('token')
		localStorage.removeItem('tokenExpired')
	}

}





// 混入
import mixins from '@/utils/mixins.js'
Vue.mixin(mixins);//时间引用


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
